package com.ruoyi.statisticalCenter.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.domain.vo.TableVo;
import com.ruoyi.common.service.TableService;
import com.ruoyi.common.utils.GetDateStringUtils;
import com.ruoyi.hqfinance.mapper.HqClientRelationMapper;
import com.ruoyi.logistic.domain.PageDate;
import com.ruoyi.logistic.domain.PageInfo;
import com.ruoyi.logistic.domain.ScContractAreaSendCostCalculateDetail;
import com.ruoyi.logistic.domain.vo.ChildrenVo;
import com.ruoyi.logistic.mapper.ScContractAreaSendCostCalculateDetailMapper;
import com.ruoyi.qualityControl.domain.ScOutBoundSendSheet;
import com.ruoyi.statisticalCenter.domain.ScContractAreaSendCostCalculate;
import com.ruoyi.statisticalCenter.domain.ScOutReturnSheet;
import com.ruoyi.statisticalCenter.domain.vo.DateStrVo;
import com.ruoyi.statisticalCenter.domain.vo.ScContractAreaSendCostCalculateVo;
import com.ruoyi.statisticalCenter.domain.vo.ScOutReturnSheetVo;
import com.ruoyi.statisticalCenter.mapper.ScContractAreaSendCostCalculateMapper;
import com.ruoyi.statisticalCenter.mapper.ScOutBoundSendSheetMapper;
import com.ruoyi.statisticalCenter.service.ScContractAreaSendCostCalculateService;
import com.ruoyi.statisticalCenter.service.ScOutReturnSheetService;
import com.ruoyi.statisticalCenter.utils.BigDecimalUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;

@Service
public class ScContractAreaSendCostCalculateServiceImpl implements ScContractAreaSendCostCalculateService {
    @Autowired
    private ScContractAreaSendCostCalculateMapper scContractAreaSendCostCalculateMapper;

    @Autowired
    private TableService tableService;
    @Autowired
    private ScOutReturnSheetService scOutReturnSheetService;
    @Autowired
    private HqClientRelationMapper hqClientRelationMapper;
    @Autowired
    private ScContractAreaSendCostCalculateDetailMapper scContractAreaSendCostCalculateDetailMapper;
    
    @Autowired
    private ScOutBoundSendSheetMapper scOutBoundSendSheetMapper;

    @Override
    public R collect(ScContractAreaSendCostCalculateVo vo) {
        if (vo.getCostModel()==null||"".equals(vo.getCostModel())) {
            vo.setCostModel(1);
        }
        PageHelper.startPage(vo.getPageDate());
        List<ScContractAreaSendCostCalculate> costCalculates = scContractAreaSendCostCalculateDetailMapper.selectByVo(vo);
        for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
            costCalculate.setFixedWarehousingFee(costCalculate.getFixedWarehousingFee().setScale(0,RoundingMode.HALF_UP));
        }
        if (costCalculates==null || costCalculates.size()<=0){
            PageHelper.startPage(vo.getPageDate());
            costCalculates = collectExportList(vo);
        }

        /*for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
            List<String> dateStr = GetDateStringUtils.getDateStr(vo.getStartTime(), vo.getEndTime());
            for (String date : dateStr) {
                ChildrenVo childrenVo = new ChildrenVo();
                BeanUtils.copyProperties(vo,childrenVo);
                childrenVo.setStartTime(date);
                childrenVo.setEndTime(date);
                childrenVo.setContractAreaName(costCalculate.getContractAreaName());
                List<ScContractAreaSendCostCalculate> children = scContractAreaSendCostCalculateDetailMapper.selectByChildrenVo(vo);
            }
        }*/
        
        //List<ScContractAreaSendCostCalculate> costCalculates = scContractAreaSendCostCalculateDetailMapper.selectByVo(vo);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("list", PageInfo.info(costCalculates));
        jsonObject.put("fields", getTableVo());

        if (costCalculates == null || costCalculates.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(jsonObject);
        }
    }

    @Override
    public List<ScContractAreaSendCostCalculate> collectExportList(ScContractAreaSendCostCalculateVo vo) {
        List<ScContractAreaSendCostCalculate> costCalculatesCache = scContractAreaSendCostCalculateDetailMapper.selectByVo(vo);
        if (costCalculatesCache!=null && costCalculatesCache.size()>0){
            return costCalculatesCache;
        }
        List<ScContractAreaSendCostCalculate> costCalculates = scContractAreaSendCostCalculateMapper.collect(vo);
        
        
        Integer collectType = vo.getCollectType();
        List<ScContractAreaSendCostCalculate> scContractAreaSendCostCalculates = null;
        BigDecimal sheetSaleroomSum = new BigDecimal(0.00);
        Map<String, BigDecimal> scOutMap = new HashMap<>();
        List<ScOutBoundSendSheet> scOutBoundSendSheets = scOutBoundSendSheetMapper.selectAll();
        if (collectType!=2){
            vo.setCollectType(2);
            scContractAreaSendCostCalculates = this.collectExportList(vo);
            vo.setCollectType(collectType);
            
            scOutMap = scOutBoundSendSheets.stream().collect(Collectors.toMap(a -> a.getContractArea(), a -> BigDecimal.valueOf(0.00)));
            for (ScContractAreaSendCostCalculate scContractAreaSendCostCalculate : scContractAreaSendCostCalculates) {
                BigDecimal sheetSaleroom = scContractAreaSendCostCalculate.getSheetSaleroom();
                if (sheetSaleroom!=null) {
                    sheetSaleroomSum = sheetSaleroomSum.add(scContractAreaSendCostCalculate.getSheetSaleroom());
                    String name = scContractAreaSendCostCalculate.getContractAreaName();
                    BigDecimal bigDecimal = scOutMap.get(name);
                    if (bigDecimal == null) {
                        name = "辽宁盘锦公司";
                        bigDecimal = scOutMap.get(name);
                    }
                    scOutMap.put(name, bigDecimal.add(scContractAreaSendCostCalculate.getSheetSaleroom()));
                }
            }
            
        }
        //承包区和网点的面单销售额取值
        assert costCalculates != null;
        Map<String, BigDecimal> mapPaymentContractAreaRebateTotal = new HashMap<>();
        
        Map<String, BigDecimal> mapPaymentContractAreaRebateTotalByArea = scOutBoundSendSheets.stream().collect(Collectors.toMap(a->a.getContractArea(),a->BigDecimal.valueOf(0.00)));
        BigDecimal sumPaymentContractAreaRebateTotal = BigDecimal.valueOf(0.00);
        //if (vo.getCollectType() == 0) {
            ScOutReturnSheetVo scVo = new ScOutReturnSheetVo();
            scVo.setNetworkLevel(2);
            scVo.setStartTime(vo.getStartTime());
            scVo.setEndTime(vo.getEndTime());
            PageDate pageDate = new PageDate();
            pageDate.setPageSize(1000);
            pageDate.setPageNum(1);
            scVo.setPageDate(pageDate);
            List<ScOutReturnSheet> scOutReturnSheets = scOutReturnSheetService.collectExport(scVo);
            mapPaymentContractAreaRebateTotal = scOutReturnSheets.stream().collect(Collectors.toMap(a -> a.getName(), a -> a.getPaymentContractAreaRebateTotal() != null ? a.getPaymentContractAreaRebateTotal() : new BigDecimal(0.00)));
            
        for (ScOutReturnSheet scOutReturnSheet : scOutReturnSheets) {
            String name = scOutReturnSheet.getName();
            BigDecimal bigDecimal = mapPaymentContractAreaRebateTotalByArea.get(name);
            if (bigDecimal == null){
                name = "辽宁盘锦公司";
                bigDecimal = mapPaymentContractAreaRebateTotalByArea.get(name);
            }
            mapPaymentContractAreaRebateTotalByArea.put(name,bigDecimal.add(scOutReturnSheet.getPaymentContractAreaRebateTotal()));
            sumPaymentContractAreaRebateTotal = sumPaymentContractAreaRebateTotal.add(scOutReturnSheet.getPaymentContractAreaRebateTotal());
        }
            //}
        assert costCalculates != null;

        if (collectType==2){
            for (ScOutReturnSheet scOutReturnSheet : scOutReturnSheets) {
                int i = 0;
                for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
                    if (scOutReturnSheet.getName().equals(costCalculate.getContractAreaName())){
                        i = 1;
                    }
                }
                if (i == 0){
                    ScContractAreaSendCostCalculate scContractAreaSendCostCalculate = new ScContractAreaSendCostCalculate();
                    scContractAreaSendCostCalculate.setContractAreaName(scOutReturnSheet.getName());
                    scContractAreaSendCostCalculate.setPayContractAreaRebate(scOutReturnSheet.getPaymentContractAreaRebateTotal());
                    costCalculates.add(scContractAreaSendCostCalculate);
                }
            }
        }
        for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
            costCalculate.setCollectDate(vo.getStartTime() + "至" + vo.getEndTime());

//            costCalculate.setTransferFee(BigDecimalUtils.roundBigDecimal(costCalculate.getTransferFee(), 2));
            costCalculate.setTransferExamine(BigDecimalUtils.roundBigDecimal(costCalculate.getTransferExamine(), 2));
            costCalculate.setTotalOutboundReceivableFee(BigDecimalUtils.roundBigDecimal(costCalculate.getTotalOutboundReceivableFee(), 2));
            costCalculate.setLargeCargoDeliveryChargeAmount(BigDecimalUtils.roundBigDecimal(costCalculate.getLargeCargoDeliveryChargeAmount(), 2));
            costCalculate.setLargeCargoDeliveryChargeUnitPrice(BigDecimalUtils.roundBigDecimal(costCalculate.getLargeCargoDeliveryChargeUnitPrice(), 3));
            costCalculate.setLargeCargoHandlingFeeReceivableAmount(BigDecimalUtils.roundBigDecimal(costCalculate.getLargeCargoHandlingFeeReceivableAmount(), 2));
            costCalculate.setOutboundHandlingFeeReceivableAmount(BigDecimalUtils.roundBigDecimal(costCalculate.getOutboundHandlingFeeReceivableAmount(), 2));
            costCalculate.setPeriodicDeliveryCharge(BigDecimalUtils.roundBigDecimal(costCalculate.getPeriodicDeliveryCharge(), 2));
            costCalculate.setTownSubsidyCharge(BigDecimalUtils.roundBigDecimal(costCalculate.getTownSubsidyCharge(), 2));
            costCalculate.setReturnHandlingFee(BigDecimalUtils.roundBigDecimal(costCalculate.getReturnHandlingFee(), 2));
            costCalculate.setReturnTransferFee(BigDecimalUtils.roundBigDecimal(costCalculate.getReturnTransferFee(), 2));
            costCalculate.setEnterReturnTransferFee(BigDecimalUtils.roundBigDecimal(costCalculate.getEnterReturnTransferFee(), 2));
            costCalculate.setIrregularItemHandlingFee(BigDecimalUtils.roundBigDecimal(costCalculate.getIrregularItemHandlingFee(), 2));
            costCalculate.setEnterIrregularItemHandlingFee(BigDecimalUtils.roundBigDecimal(costCalculate.getEnterIrregularItemHandlingFee(), 2));
            costCalculate.setDrayage(BigDecimalUtils.roundBigDecimal(costCalculate.getDrayage(), 2));
            costCalculate.setNetFineReturnExamine(BigDecimalUtils.roundBigDecimal(costCalculate.getNetFineReturnExamine(), 2));
            costCalculate.setThreeHundredComplaint(BigDecimalUtils.roundBigDecimal(costCalculate.getThreeHundredComplaint(), 2));

            BigDecimal bigDecimal = new BigDecimal(0.00);
            if (costCalculate.getLargeCargoHandlingFeeReceivableParcelCount() != 0) {
                costCalculate.setLargeCargoHandlingFeeUnitPrice(
                        costCalculate.getLargeCargoHandlingFeeReceivableAmount().divide(BigDecimal.valueOf(costCalculate.getLargeCargoHandlingFeeReceivableParcelCount()), 3, RoundingMode.HALF_UP)
                );
            } else {
                costCalculate.setLargeCargoHandlingFeeUnitPrice(bigDecimal);
            }
            if (costCalculate.getOutboundHandlingFeeReceivableParcelCount() != 0) {
                costCalculate.setOutboundHandlingFeeUnitPrice(
                        costCalculate.getOutboundHandlingFeeReceivableAmount().divide(BigDecimal.valueOf(costCalculate.getOutboundHandlingFeeReceivableParcelCount()), RoundingMode.HALF_UP)
                );
            } else {
                costCalculate.setOutboundHandlingFeeUnitPrice(bigDecimal);
            }
            if (costCalculate.getBasicDeliveryChargeAdjustmentParcelCount() != 0) {
                costCalculate.setBasicDeliveryChargeAdjustmentUnitPrice(
                        costCalculate.getBasicDeliveryChargeAdjustmentAmount().divide(BigDecimal.valueOf(costCalculate.getBasicDeliveryChargeAdjustmentParcelCount()), 3, RoundingMode.HALF_UP)
                );
            } else {
                costCalculate.setBasicDeliveryChargeAdjustmentUnitPrice(bigDecimal);
            }
            int time = Integer.parseInt(vo.getEndTime())-Integer.parseInt(vo.getStartTime());
            if (time == 0){
                time =1;
            }
            int year = Integer.parseInt(vo.getStartTime().substring(0, 4));
            int month = Integer.parseInt(vo.getStartTime().substring(4, 6));
            int days = YearMonth.of(year, month).lengthOfMonth();
            BigDecimal fixedWarehousingFee = costCalculate.getFixedWarehousingFee();
            BigDecimal multiply = BigDecimal.valueOf(0);
            if (fixedWarehousingFee!=null && fixedWarehousingFee.compareTo(BigDecimal.ZERO)!=0){
                multiply = fixedWarehousingFee.divide(new BigDecimal(days), 3, RoundingMode.HALF_UP).multiply(new BigDecimal(time));
            }
            costCalculate.setFixedWarehousingFee(multiply);
            if (vo.getCollectType() == 0) {
                BigDecimal selectByFix = hqClientRelationMapper.selectByFix();
                multiply = selectByFix.divide(new BigDecimal(days), 3, RoundingMode.HALF_UP).multiply(new BigDecimal(time));
                costCalculate.setFixedWarehousingFee(multiply);
                /*List<ScContractAreaSendCostCalculate> list = scContractAreaSendCostCalculateMapper.findBigClientAmount(vo);
                BigDecimal sheetSaleroom = list.stream()
                        .map(item -> item.getSheetSaleroom() != null ? item.getSheetSaleroom() : BigDecimal.ZERO) // 如果getSheetSaleroom返回null，则使用BigDecimal.ZERO
                        .reduce(BigDecimal.ZERO, BigDecimal::add);*/
                BigDecimal sheetSaleroom = sheetSaleroomSum;
                costCalculate.setSheetSaleroom(sheetSaleroom);
                BigDecimal dispatchParcelCount = BigDecimal.valueOf(costCalculate.getDispatchParcelCount());
                MathContext mc = new MathContext(3, RoundingMode.HALF_UP); // 精确到10位小数，采用四舍五入
                if (dispatchParcelCount.doubleValue() != 0) {
                    costCalculate.setSheetTopUpPrice(sheetSaleroom.divide(dispatchParcelCount, mc));
                } else {
                    costCalculate.setSheetTopUpPrice(BigDecimal.valueOf(0));
                }

                costCalculate.setSheetSurplus(sheetSaleroom.subtract(costCalculate.getSheetCost()));
                costCalculate.setPayContractAreaRebate(sumPaymentContractAreaRebateTotal);
            }else
            //支付承包区返利合计
            if (vo.getCollectType() == 1){
                if (mapPaymentContractAreaRebateTotalByArea.get(costCalculate.getContractAreaName()) != null) {
                    costCalculate.setPayContractAreaRebate(mapPaymentContractAreaRebateTotalByArea.get(costCalculate.getContractAreaName()));
                } else {
                    costCalculate.setPayContractAreaRebate(BigDecimal.valueOf(0.00));
                }
            }else if (vo.getCollectType() == 2){
                if (mapPaymentContractAreaRebateTotal.get(costCalculate.getContractAreaName()) != null) {
                    costCalculate.setPayContractAreaRebate(mapPaymentContractAreaRebateTotal.get(costCalculate.getContractAreaName()));
                } else {
                    costCalculate.setPayContractAreaRebate(BigDecimal.valueOf(0.00));
                }
            }
            
            if (costCalculate.getDispatchParcelCount() != null && costCalculate.getSheetTopUpPrice() != null) {
                if (vo.getCollectType()!=0){
                    costCalculate.setSheetSaleroom(new BigDecimal(costCalculate.getDispatchParcelCount()).multiply(costCalculate.getSheetTopUpPrice()));
                }
                if (vo.getCollectType()==1){
                    costCalculate.setSheetSaleroom(scOutMap.get(costCalculate.getContractAreaName()));
                }
                costCalculate.setSheetSurplus(costCalculate.getSheetSaleroom().subtract(costCalculate.getSheetCost()));
            }
            if (vo.getCollectType()==1){
                costCalculate.setSheetSaleroom(scOutMap.get(costCalculate.getContractAreaName()));
            }
            //出港成本
            BigDecimal outBoundCost = new BigDecimal(0.00);
            if (costCalculate.getTransferFee() != null) {
                outBoundCost = outBoundCost.add(BigDecimal.valueOf(costCalculate.getTransferFee()));
            }
            if (costCalculate.getTotalOutboundReceivableFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getTotalOutboundReceivableFee());
            }
            if (costCalculate.getLargeCargoDeliveryChargeAmount() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getLargeCargoDeliveryChargeAmount());
            }
            if (costCalculate.getLargeCargoHandlingFeeReceivableAmount() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getLargeCargoHandlingFeeReceivableAmount());
            }
            if (costCalculate.getFixedWarehousingFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getFixedWarehousingFee());
            }
            if (costCalculate.getOutboundHandlingFeeReceivableAmount() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getOutboundHandlingFeeReceivableAmount());
            }
            if (costCalculate.getBasicDeliveryChargeAdjustmentAmount() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getBasicDeliveryChargeAdjustmentAmount());
            }
            if (costCalculate.getPeriodicDeliveryCharge() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getPeriodicDeliveryCharge());
            }
            if (costCalculate.getTownSubsidyCharge() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getTownSubsidyCharge());
            }
            if (costCalculate.getReturnHandlingFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getReturnHandlingFee());
            }
            if (costCalculate.getReturnTransferFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getReturnTransferFee());
            }
            if (costCalculate.getEnterReturnTransferFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getEnterReturnTransferFee());
            }
            if (costCalculate.getIrregularItemHandlingFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getIrregularItemHandlingFee());
            }
            if (costCalculate.getEnterIrregularItemHandlingFee() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getEnterIrregularItemHandlingFee());
            }
            if (costCalculate.getDrayage() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getDrayage());
            }
            if (costCalculate.getNetFineReturnExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getNetFineReturnExamine());
            }
            if (costCalculate.getThreeHundredComplaint() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getThreeHundredComplaint());
            }
            if (costCalculate.getOverweightFineExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getOverweightFineExamine());
            }
            if (costCalculate.getLanshouTimeExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getLanshouTimeExamine());
            }
            if (costCalculate.getRealNameExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getRealNameExamine());
            }
            if (costCalculate.getLogisticsInfoExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getLogisticsInfoExamine());
            }
            if (costCalculate.getDeliveryTimeExamine() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getDeliveryTimeExamine());
            }
            if (costCalculate.getContraband() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getContraband());
            }
            if (costCalculate.getEncapsulationNotStandard() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getEncapsulationNotStandard());
            }
            if (costCalculate.getErrorSent() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getErrorSent());
            }
            if (costCalculate.getViolateUseThermalLabelReceipt() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getViolateUseThermalLabelReceipt());
            }
            if (costCalculate.getSheetSaleroom() != null) {
                outBoundCost = outBoundCost.add(costCalculate.getSheetSaleroom());
            }
            if (costCalculate.getPayContractAreaRebate() != null) {
                outBoundCost = outBoundCost.subtract(costCalculate.getPayContractAreaRebate());
            }
            costCalculate.setOutBoundCost(outBoundCost);
            if (costCalculate.getDispatchParcelCount() != null && costCalculate.getDispatchParcelCount() != 0) {
                costCalculate.setOneTicketCost(costCalculate.getOutBoundCost().divide(BigDecimal.valueOf(costCalculate.getDispatchParcelCount()), 3));
            }

            if (costCalculate.getSheetSaleroom() == null){
                costCalculate.setSheetSaleroom(BigDecimal.ZERO);
                costCalculate.setSheetSurplus(costCalculate.getSheetSaleroom().subtract(costCalculate.getSheetCost()));
            }
            if (vo.getCollectType() == 1){
                costCalculate.setSheetSurplus(costCalculate.getSheetSaleroom().subtract(costCalculate.getSheetCost()));
            }

        }
        return costCalculates;
    }

    @Override
    public List<ScContractAreaSendCostCalculate> collectExport(ScContractAreaSendCostCalculateVo vo, OutputStream outputStream) {
        List<ScContractAreaSendCostCalculate> costCalculates = scContractAreaSendCostCalculateDetailMapper.selectByVo(vo);
        if (costCalculates==null || costCalculates.size()<=0){
            PageHelper.startPage(vo.getPageDate());
            costCalculates = collectExportList(vo);
        }
        for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
            costCalculate.setFixedWarehousingFee(costCalculate.getFixedWarehousingFee().setScale(0,RoundingMode.HALF_UP));
        }
        Workbook workbook = new XSSFWorkbook(); // 创建一个新的Excel工作簿
        Sheet sheet = workbook.createSheet("Amount Data"); // 创建一个新的工作表


        // 创建边框样式
        CellStyle borderStyle = workbook.createCellStyle();
        BorderStyle thin = BorderStyle.THIN;
        short blackColorIndex = IndexedColors.BLACK.getIndex();
        borderStyle.setBorderTop(thin);
        borderStyle.setBorderBottom(thin);
        borderStyle.setBorderLeft(thin);
        borderStyle.setBorderRight(thin);
        borderStyle.setTopBorderColor(blackColorIndex);
        borderStyle.setBottomBorderColor(blackColorIndex);
        borderStyle.setLeftBorderColor(blackColorIndex);
        borderStyle.setRightBorderColor(blackColorIndex);

        // 创建表头样式
        CellStyle headerStyle = workbook.createCellStyle();
        Font headerFont = workbook.createFont();
        headerFont.setBold(true);
        headerFont.setFontHeightInPoints((short) 14); // 设置字体大小
        headerStyle.setFont(headerFont);
        headerStyle.setAlignment(HorizontalAlignment.CENTER); // 设置水平居中
        headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); // 设置垂直居中
        headerStyle.setBorderTop(thin);
        headerStyle.setBorderBottom(thin);
        headerStyle.setBorderLeft(thin);
        headerStyle.setBorderRight(thin);
        headerStyle.setTopBorderColor(blackColorIndex);
        headerStyle.setBottomBorderColor(blackColorIndex);
        headerStyle.setLeftBorderColor(blackColorIndex);
        headerStyle.setRightBorderColor(blackColorIndex);

        Row headerRow = sheet.createRow(0); // 创建表头行
        String[] headers = {"统计日期", "名称", "出件票数", "包仓外中转费", "中转考核", "全网出港费应收", "大货计重收费-金额",
                "大货计重收费-票数", "大货计重收费-单价", "大货操作费-金额", "大货操作费-票数", "大货操作费-单价", "包仓费",
                "出港操作费-金额", "出港操作费-票数", "出港操作费-单价", "基础派费收费调整-金额", "基础派费收费调整-票数",
                "基础派费收费调整-单价", "周期性派费收费", "乡镇村业务费用", "退件操作费", "退件中转费", "进港退件操作费",
                "异形件操作费", "进港异形件操作费", "短驳费", "网点违规退回考核", "三个100%投诉", "违规重量考核", "揽收时效考核",
                "实名制考核收费", "物流信息考核", "交货时效考核", "违禁品", "合包不规范", "错发件", "热敏面单未规范使用",
                "面单购进单价", "面单成本", "面单充值单价", "面单销售额", "面单结余", "支付承包区返利合计", "出港成本", "单票成本"};
        for (int i = 0; i < headers.length; i++) {
            Cell cell = headerRow.createCell(i);
            cell.setCellValue(headers[i]);
            cell.setCellStyle(headerStyle); // 应用表头样式
        }
        /*headerRow.createCell(0).setCellValue("统计日期");
        headerRow.createCell(1).setCellValue("名称");
        headerRow.createCell(2).setCellValue("出件票数");
        headerRow.createCell(3).setCellValue("包仓外中转费");
        headerRow.createCell(4).setCellValue("中转考核");
        headerRow.createCell(5).setCellValue("全网出港费应收");
        headerRow.createCell(6).setCellValue("大货计重收费-金额");
        headerRow.createCell(7).setCellValue("大货计重收费-票数");
        headerRow.createCell(8).setCellValue("大货计重收费-单价");
        headerRow.createCell(9).setCellValue("大货操作费-金额");
        headerRow.createCell(10).setCellValue("大货操作费-票数");
        headerRow.createCell(11).setCellValue("大货操作费-单价");
        headerRow.createCell(12).setCellValue("包仓费");
        headerRow.createCell(13).setCellValue("出港操作费-金额");
        headerRow.createCell(14).setCellValue("出港操作费-票数");
        headerRow.createCell(15).setCellValue("出港操作费-单价");
        headerRow.createCell(16).setCellValue("基础派费收费调整-金额");
        headerRow.createCell(17).setCellValue("基础派费收费调整-票数");
        headerRow.createCell(18).setCellValue("基础派费收费调整-单价");
        headerRow.createCell(19).setCellValue("周期性派费收费");
        headerRow.createCell(20).setCellValue("乡镇村业务费用");
        headerRow.createCell(21).setCellValue("退件操作费");
        headerRow.createCell(22).setCellValue("退件中转费");
        headerRow.createCell(23).setCellValue("进港退件操作费");
        headerRow.createCell(24).setCellValue("异形件操作费");
        headerRow.createCell(25).setCellValue("进港异形件操作费");
        headerRow.createCell(26).setCellValue("短驳费");
        headerRow.createCell(27).setCellValue("网点违规退回考核");
        headerRow.createCell(28).setCellValue("三个100%投诉");
        headerRow.createCell(29).setCellValue("违规重量考核");
        headerRow.createCell(30).setCellValue("揽收时效考核");
        headerRow.createCell(31).setCellValue("实名制考核收费");
        headerRow.createCell(32).setCellValue("物流信息考核");
        headerRow.createCell(33).setCellValue("交货时效考核");
        headerRow.createCell(34).setCellValue("违禁品");
        headerRow.createCell(35).setCellValue("合包不规范");
        headerRow.createCell(36).setCellValue("错发件");
        headerRow.createCell(37).setCellValue("热敏面单未规范使用");
        headerRow.createCell(38).setCellValue("面单购进单价");
        headerRow.createCell(39).setCellValue("面单成本");
        headerRow.createCell(40).setCellValue("面单充值单价");
        headerRow.createCell(41).setCellValue("面单销售额");
        headerRow.createCell(42).setCellValue("面单结余");
        headerRow.createCell(43).setCellValue("支付承包区返利合计");
        headerRow.createCell(44).setCellValue("出港成本");
        headerRow.createCell(45).setCellValue("单票成本");*/

        int rowNum = 1; // 行索引从1开始（因为已经有表头行）
        DecimalFormat df2 = new DecimalFormat("0.00");
        DecimalFormat df3 = new DecimalFormat("0.000");
        // 将数据写入Excel表格
        for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
            Row dataRow = sheet.createRow(rowNum++);

            Cell cell0 = dataRow.createCell(0);
            cell0.setCellValue(costCalculate.getCollectDate());
            cell0.setCellStyle(borderStyle);

            Cell cell1 = dataRow.createCell(1);
            cell1.setCellValue(costCalculate.getContractAreaName());
            cell1.setCellStyle(borderStyle);

            Cell dispatchParcelCountCell = dataRow.createCell(2);
            dispatchParcelCountCell.setCellValue(costCalculate.getDispatchParcelCount());
            dispatchParcelCountCell.setCellType(CellType.NUMERIC);
            dispatchParcelCountCell.setCellStyle(borderStyle);

            Cell transferCell = dataRow.createCell(3);
            transferCell.setCellValue(costCalculate.getTransferFee());
            transferCell.setCellType(CellType.NUMERIC);
            transferCell.setCellStyle(borderStyle);
            Cell transferExamineCell = dataRow.createCell(4);
            if (costCalculate.getTransferExamine() != null) {
                String format = df2.format(costCalculate.getTransferExamine().doubleValue());
                transferExamineCell.setCellValue(df2.format(costCalculate.getTransferExamine().doubleValue()));
            }
            transferExamineCell.setCellStyle(borderStyle);
//            transferExamineCell.setCellType(CellType.NUMERIC); // 即使值为null，也应设置为数字类型以保持格式一致性

            if (costCalculate.getTotalOutboundReceivableFee() != null) {
                Cell cell5 = dataRow.createCell(5);
                cell5.setCellValue(costCalculate.getTotalOutboundReceivableFee().doubleValue());
                cell5.setCellStyle(borderStyle);

            }

            if (costCalculate.getLargeCargoDeliveryChargeAmount() != null) {
                Cell cell6 = dataRow.createCell(6);
                cell6.setCellValue(df2.format(costCalculate.getLargeCargoDeliveryChargeAmount().doubleValue()));
                cell6.setCellStyle(borderStyle);
            }

            if (costCalculate.getLargeCargoDeliveryChargeParcelCount() != null) {
                Cell cell7 = dataRow.createCell(7);
                cell7.setCellValue(df2.format(costCalculate.getLargeCargoDeliveryChargeParcelCount()));
                cell7.setCellStyle(borderStyle);
            }

            if (costCalculate.getLargeCargoDeliveryChargeUnitPrice() != null) {
                Cell cell8 = dataRow.createCell(8);
                cell8.setCellValue(df3.format(costCalculate.getLargeCargoDeliveryChargeUnitPrice().doubleValue()));
                cell8.setCellStyle(borderStyle);
            }

            if (costCalculate.getLargeCargoHandlingFeeReceivableAmount() != null) {
                Cell cell9 = dataRow.createCell(9);
                cell9.setCellValue(df2.format(costCalculate.getLargeCargoHandlingFeeReceivableAmount().doubleValue()));
                cell9.setCellStyle(borderStyle);
            }

            if (costCalculate.getLargeCargoHandlingFeeReceivableParcelCount() != null) {
                Cell cell10 = dataRow.createCell(10);
                cell10.setCellValue(costCalculate.getLargeCargoHandlingFeeReceivableParcelCount());
                cell10.setCellStyle(borderStyle);
            }

            if (costCalculate.getLargeCargoHandlingFeeUnitPrice() != null) {
                Cell cell11 = dataRow.createCell(11);
                cell11.setCellValue(df3.format(costCalculate.getLargeCargoHandlingFeeUnitPrice().doubleValue()));
                cell11.setCellStyle(borderStyle);
            }

            if (costCalculate.getFixedWarehousingFee() != null) {
                Cell cell12 = dataRow.createCell(12);
                cell12.setCellValue(df2.format(costCalculate.getFixedWarehousingFee().doubleValue()));
                cell12.setCellStyle(borderStyle);
            }


            if (costCalculate.getOutboundHandlingFeeReceivableAmount() != null) {
                Cell cell13 = dataRow.createCell(13);
                cell13.setCellValue(df2.format(costCalculate.getOutboundHandlingFeeReceivableAmount().doubleValue()));
                cell13.setCellStyle(borderStyle);
            }

            if (costCalculate.getOutboundHandlingFeeReceivableParcelCount() != null) {
                Cell cell14 = dataRow.createCell(14);
                cell14.setCellValue(costCalculate.getOutboundHandlingFeeReceivableParcelCount());
                cell14.setCellStyle(borderStyle);
            }

            if (costCalculate.getOutboundHandlingFeeUnitPrice() != null) {
                Cell cell15 = dataRow.createCell(15);
                cell15.setCellValue(df3.format(costCalculate.getOutboundHandlingFeeUnitPrice().doubleValue()));
                cell15.setCellStyle(borderStyle);
            }

            if (costCalculate.getBasicDeliveryChargeAdjustmentAmount() != null) {
                Cell cell16 = dataRow.createCell(16);
                cell16.setCellValue(df2.format(costCalculate.getBasicDeliveryChargeAdjustmentAmount().doubleValue()));
                cell16.setCellStyle(borderStyle);
            }

            if (costCalculate.getBasicDeliveryChargeAdjustmentParcelCount() != null) {
                Cell cell17 = dataRow.createCell(17);
                cell17.setCellValue(costCalculate.getBasicDeliveryChargeAdjustmentParcelCount());
                cell17.setCellStyle(borderStyle);
            }

            if (costCalculate.getBasicDeliveryChargeAdjustmentUnitPrice() != null) {
                Cell cell18 = dataRow.createCell(18);
                cell18.setCellValue(df3.format(costCalculate.getBasicDeliveryChargeAdjustmentUnitPrice().doubleValue()));
                cell18.setCellStyle(borderStyle);
            }

            if (costCalculate.getPeriodicDeliveryCharge() != null) {
                Cell cell19 = dataRow.createCell(19);
                cell19.setCellValue(df2.format(costCalculate.getPeriodicDeliveryCharge().doubleValue()));
                cell19.setCellStyle(borderStyle);
            }

            if (costCalculate.getTownSubsidyCharge() != null) {
                Cell cell20 = dataRow.createCell(20);
                cell20.setCellValue(df2.format(costCalculate.getTownSubsidyCharge().doubleValue()));
                cell20.setCellStyle(borderStyle);
            }

            if (costCalculate.getReturnHandlingFee() != null) {
                Cell cell21 = dataRow.createCell(21);
                cell21.setCellValue(df2.format(costCalculate.getReturnHandlingFee().doubleValue()));
                cell21.setCellStyle(borderStyle);
            }

            if (costCalculate.getReturnTransferFee() != null) {
                Cell cell22 = dataRow.createCell(22);
                cell22.setCellValue(df2.format(costCalculate.getReturnTransferFee().doubleValue()));
                cell22.setCellStyle(borderStyle);
            }

            if (costCalculate.getEnterReturnTransferFee() != null) {
                Cell cell23 = dataRow.createCell(23);
                cell23.setCellValue(df2.format(costCalculate.getEnterReturnTransferFee().doubleValue()));
                cell23.setCellStyle(borderStyle);
            }

            if (costCalculate.getIrregularItemHandlingFee() != null) {
                Cell cell24 = dataRow.createCell(24);
                cell24.setCellValue(df2.format(costCalculate.getIrregularItemHandlingFee().doubleValue()));
                cell24.setCellStyle(borderStyle);
            }

            if (costCalculate.getEnterIrregularItemHandlingFee() != null) {
                Cell cell25 = dataRow.createCell(25);
                cell25.setCellValue(df2.format(costCalculate.getEnterIrregularItemHandlingFee().doubleValue()));
                cell25.setCellStyle(borderStyle);
            }

            if (costCalculate.getDrayage() != null) {
                Cell cell26 = dataRow.createCell(26);
                cell26.setCellValue(df2.format(costCalculate.getDrayage().doubleValue()));
                cell26.setCellStyle(borderStyle);
            }

            if (costCalculate.getNetFineReturnExamine() != null) {
                Cell cell27 = dataRow.createCell(27);
                cell27.setCellValue(costCalculate.getNetFineReturnExamine().doubleValue());
                cell27.setCellStyle(borderStyle);
            }

            if (costCalculate.getThreeHundredComplaint() != null) {
                Cell cell28 = dataRow.createCell(28);
                cell28.setCellValue(costCalculate.getThreeHundredComplaint().doubleValue());
                cell28.setCellStyle(borderStyle);
            }

            if (costCalculate.getOverweightFineExamine() != null) {
                Cell cell29 = dataRow.createCell(29);
                cell29.setCellValue(costCalculate.getOverweightFineExamine().doubleValue());
                cell29.setCellStyle(borderStyle);
            }

            if (costCalculate.getLanshouTimeExamine() != null) {
                Cell cell30 = dataRow.createCell(30);
                cell30.setCellValue(costCalculate.getLanshouTimeExamine().doubleValue());
                cell30.setCellStyle(borderStyle);
            }

            if (costCalculate.getRealNameExamine() != null) {
                Cell cell31 = dataRow.createCell(31);
                cell31.setCellValue(costCalculate.getRealNameExamine().doubleValue());
                cell31.setCellStyle(borderStyle);
            }

            if (costCalculate.getLogisticsInfoExamine() != null) {
                Cell cell32 = dataRow.createCell(32);
                cell32.setCellValue(costCalculate.getLogisticsInfoExamine().doubleValue());
                cell32.setCellStyle(borderStyle);
            }

            if (costCalculate.getDeliveryTimeExamine() != null) {
                Cell cell33 = dataRow.createCell(33);
                cell33.setCellValue(costCalculate.getDeliveryTimeExamine().doubleValue());
                cell33.setCellStyle(borderStyle);
            }

            if (costCalculate.getContraband() != null) {
                Cell cell34 = dataRow.createCell(34);
                cell34.setCellValue(costCalculate.getContraband().doubleValue());
                cell34.setCellStyle(borderStyle);
            }

            if (costCalculate.getEncapsulationNotStandard() != null) {
                Cell cell35 = dataRow.createCell(35);
                cell35.setCellValue(costCalculate.getEncapsulationNotStandard().doubleValue());
                cell35.setCellStyle(borderStyle);
            }

            if (costCalculate.getErrorSent() != null) {
                Cell cell36 = dataRow.createCell(36);
                cell36.setCellValue(costCalculate.getErrorSent().doubleValue());
                cell36.setCellStyle(borderStyle);
            }

            if (costCalculate.getViolateUseThermalLabelReceipt() != null) {
                Cell cell37 = dataRow.createCell(37);
                cell37.setCellValue(costCalculate.getViolateUseThermalLabelReceipt().doubleValue());
                cell37.setCellStyle(borderStyle);
            }

            if (costCalculate.getSheetBuyPrice() != null) {
                Cell cell38 = dataRow.createCell(38);
                cell38.setCellValue(costCalculate.getSheetBuyPrice().doubleValue());
                cell38.setCellStyle(borderStyle);
            }

            if (costCalculate.getSheetCost() != null) {
                Cell cell39 = dataRow.createCell(39);
                cell39.setCellValue(df2.format(costCalculate.getSheetCost().doubleValue()));
                cell39.setCellStyle(borderStyle);
            }

            if (costCalculate.getSheetTopUpPrice() != null) {
                Cell cell40 = dataRow.createCell(40);
                cell40.setCellValue(df2.format(costCalculate.getSheetTopUpPrice().doubleValue()));
                cell40.setCellStyle(borderStyle);
            }

            if (costCalculate.getSheetSaleroom() != null) {
                Cell cell41 = dataRow.createCell(41);
                cell41.setCellValue(df2.format(costCalculate.getSheetSaleroom().doubleValue()));
                cell41.setCellStyle(borderStyle);
            }

            if (costCalculate.getSheetSurplus() != null) {
                Cell cell42 = dataRow.createCell(42);
                cell42.setCellValue(df2.format(costCalculate.getSheetSurplus().doubleValue()));
                cell42.setCellStyle(borderStyle);
            }

            if (costCalculate.getPayContractAreaRebate() != null) {
                Cell cell43 = dataRow.createCell(43);
                cell43.setCellValue(costCalculate.getPayContractAreaRebate().doubleValue());
                cell43.setCellStyle(borderStyle);
            }

            if (costCalculate.getOutBoundCost() != null) {
                Cell cell44 = dataRow.createCell(44);
                cell44.setCellValue(costCalculate.getOutBoundCost().doubleValue());
                cell44.setCellStyle(borderStyle);
            }

            if (costCalculate.getOneTicketCost() != null) {
                Cell cell45 = dataRow.createCell(45);
                cell45.setCellValue(costCalculate.getOneTicketCost().doubleValue());
                cell45.setCellStyle(borderStyle);
            }
        }
        try {
            workbook.write(outputStream); // 将工作簿写入输出流
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            workbook.close(); // 关闭工作簿
        } catch (IOException e) {
            e.printStackTrace();
        }
        return costCalculates;
    }

    @Override
    public R cache(DateStrVo dateStrVo) {
        Integer[] collectTypes = {2, 1, 0};
        Integer[] costModels = {1/*, 2, 3*/};
        Integer[] dateTypes = {0};
        List<String> days = GetDateStringUtils.getDateStr(dateStrVo.getStartDateStr(), dateStrVo.getEndDateStr());
        List<String> dateStrList = scContractAreaSendCostCalculateDetailMapper.selectllDateStr();
        days.removeAll(dateStrList);

        ScContractAreaSendCostCalculateVo scContractAreaSendCostCalculateVo = new ScContractAreaSendCostCalculateVo();
        scContractAreaSendCostCalculateVo.setPageDate(new PageDate());
        for (String day : days) {
            scContractAreaSendCostCalculateVo.setStartTime(day);
            scContractAreaSendCostCalculateVo.setEndTime(day);
            for (Integer collectType : collectTypes) {
                for (Integer costModel : costModels) {
                    for (Integer dateType : dateTypes) {
                        scContractAreaSendCostCalculateVo.setCollectType(collectType);
                        scContractAreaSendCostCalculateVo.setCostModel(costModel);
                        scContractAreaSendCostCalculateVo.setDateType(dateType);
                        List<ScContractAreaSendCostCalculate> costCalculates = collectExportList(scContractAreaSendCostCalculateVo);
                        for (ScContractAreaSendCostCalculate costCalculate : costCalculates) {
                            ScContractAreaSendCostCalculateDetail scContractAreaSendCostCalculateDetail = new ScContractAreaSendCostCalculateDetail();
                            BeanUtils.copyProperties(costCalculate, scContractAreaSendCostCalculateDetail);
                            scContractAreaSendCostCalculateDetail.setCollectType(String.valueOf(collectType));
                            scContractAreaSendCostCalculateDetail.setCostModel(String.valueOf(costModel));
                            scContractAreaSendCostCalculateDetail.setDateType(String.valueOf(dateType));
                            scContractAreaSendCostCalculateDetail.setDeductPayDate(String.valueOf(day));
                            System.out.println("查询参数" + String.valueOf(collectType) + String.valueOf(costModel) + String.valueOf(dateType));
                            scContractAreaSendCostCalculateDetailMapper.insert(scContractAreaSendCostCalculateDetail);
                        }
                    }
                }
            }
            System.out.println(day + "执行完成");
        }
//        scContractAreaSendCostCalculateDetailMapper.insertList(list);
        return R.ok("ok");
    }

    public List<TableVo> getTableVo() {

        //一级标题
        List<TableVo> first = new ArrayList<>();
        TableVo firstTableVo = new TableVo();
        firstTableVo.setFields("collectDate");
        firstTableVo.setTranslate("统计日期");
        firstTableVo.setIsPoint(0);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("contractAreaName");
        firstTableVo.setTranslate("承包区名称");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("dispatchParcelCount");
        firstTableVo.setTranslate("出件票数");
        firstTableVo.setIsPoint(1);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("transferFee");
        firstTableVo.setTranslate("包仓外中转费");
        firstTableVo.setIsPoint(2);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("transferExamine");
        firstTableVo.setTranslate("中转考核");
        firstTableVo.setIsPoint(3);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("totalOutboundReceivableFee");
        firstTableVo.setTranslate("全网出港费应收");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("bigA");
        firstTableVo.setTranslate("大货计重收费");
        List<TableVo> second = new ArrayList<>();
        TableVo secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoDeliveryChargeAmount");
        secondTableVo.setTranslate("金额");
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoDeliveryChargeParcelCount");
        secondTableVo.setTranslate("票数");
        secondTableVo.setIsPoint(4);
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoDeliveryChargeUnitPrice");
        secondTableVo.setTranslate("单价");
        second.add(secondTableVo);
        firstTableVo.setSunList(second);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("bigDo");
        firstTableVo.setTranslate("大货操作费");
        second = new ArrayList<>();
        secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoHandlingFeeReceivableAmount");
        secondTableVo.setTranslate("金额");
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoHandlingFeeReceivableParcelCount");
        secondTableVo.setTranslate("票数");
        secondTableVo.setIsPoint(5);
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("largeCargoHandlingFeeUnitPrice");
        secondTableVo.setTranslate("单价");
        second.add(secondTableVo);
        firstTableVo.setSunList(second);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("fixedWarehousingFee");
        firstTableVo.setTranslate("包仓费");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("out");
        firstTableVo.setTranslate("出港操作费");
        first.add(firstTableVo);
        second = new ArrayList<>();
        secondTableVo = new TableVo();
        secondTableVo.setFields("outboundHandlingFeeReceivableAmount");
        secondTableVo.setTranslate("金额");
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("outboundHandlingFeeReceivableParcelCount");
        secondTableVo.setTranslate("票数");
        secondTableVo.setIsPoint(6);
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("outboundHandlingFeeUnitPrice");
        secondTableVo.setTranslate("单价");
        second.add(secondTableVo);
        firstTableVo.setSunList(second);
        firstTableVo = new TableVo();
        firstTableVo.setFields("jc");
        firstTableVo.setTranslate("基础派费收费调整");
        first.add(firstTableVo);
        second = new ArrayList<>();
        secondTableVo = new TableVo();
        secondTableVo.setFields("basicDeliveryChargeAdjustmentAmount");
        secondTableVo.setTranslate("金额");
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("basicDeliveryChargeAdjustmentParcelCount");
        secondTableVo.setTranslate("票数");
        secondTableVo.setIsPoint(7);
        second.add(secondTableVo);
        secondTableVo = new TableVo();
        secondTableVo.setFields("basicDeliveryChargeAdjustmentUnitPrice");
        secondTableVo.setTranslate("单价");
        second.add(secondTableVo);
        firstTableVo.setSunList(second);
        firstTableVo = new TableVo();
        firstTableVo.setFields("periodicDeliveryCharge");
        firstTableVo.setTranslate("周期性派费收费");
        firstTableVo.setIsPoint(8);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("townSubsidyCharge");
        firstTableVo.setTranslate("乡镇村业务费用");
        firstTableVo.setIsPoint(9);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("returnHandlingFee");
        firstTableVo.setTranslate("退件操作费");
        firstTableVo.setIsPoint(10);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("returnTransferFee");
        firstTableVo.setTranslate("退件中转费");
        firstTableVo.setIsPoint(11);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("enterReturnTransferFee");
        firstTableVo.setTranslate("进港退件操作费");
        firstTableVo.setIsPoint(12);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("irregularItemHandlingFee");
        firstTableVo.setTranslate("异形件操作费");
        firstTableVo.setIsPoint(13);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("enterIrregularItemHandlingFee");
        firstTableVo.setTranslate("进港异形件操作费");
        firstTableVo.setIsPoint(14);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("drayage");
        firstTableVo.setTranslate("短驳费");
        firstTableVo.setIsPoint(15);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("netFineReturnExamine");
        firstTableVo.setTranslate("网点违规退回考核");
        firstTableVo.setIsPoint(16);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("threeHundredComplaint");
        firstTableVo.setTranslate("三个100%投诉");
        firstTableVo.setIsPoint(17);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("overweightFineExamine");
        firstTableVo.setTranslate("违规重量考核");
        firstTableVo.setIsPoint(18);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("lanshouTimeExamine");
        firstTableVo.setTranslate("揽收时效考核");
        firstTableVo.setIsPoint(19);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("realNameExamine");
        firstTableVo.setTranslate("实名制考核收费");
        firstTableVo.setIsPoint(20);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("logisticsInfoExamine");
        firstTableVo.setTranslate("物流信息考核");
        firstTableVo.setIsPoint(21);
        first.add(firstTableVo);

        firstTableVo = new TableVo();
        firstTableVo.setFields("deliveryTimeExamine");
        firstTableVo.setTranslate("交货时效考核");
        firstTableVo.setIsPoint(22);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("contraband");
        firstTableVo.setTranslate("违禁品");
        firstTableVo.setIsPoint(23);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("encapsulationNotStandard");
        firstTableVo.setTranslate("合包不规范");
        firstTableVo.setIsPoint(24);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("errorSent");
        firstTableVo.setTranslate("错发件");
        firstTableVo.setIsPoint(25);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("violateUseThermalLabelReceipt");
        firstTableVo.setTranslate("热敏面单未规范使用");
        firstTableVo.setIsPoint(26);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("sheetBuyPrice");
        firstTableVo.setTranslate("面单购进单价");
        firstTableVo.setIsPoint(27);
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("sheetCost");
        firstTableVo.setTranslate("面单成本");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("sheetTopUpPrice");
        firstTableVo.setTranslate("面单充值单价");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("sheetSaleroom");
        firstTableVo.setTranslate("面单销售额");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("sheetSurplus");
        firstTableVo.setTranslate("面单结余");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("payContractAreaRebate");
        firstTableVo.setTranslate("支付承包区返利合计");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("outBoundCost");
        firstTableVo.setTranslate("出港成本");
        first.add(firstTableVo);
        firstTableVo = new TableVo();
        firstTableVo.setFields("oneTicketCost");
        firstTableVo.setTranslate("单票成本");
        first.add(firstTableVo);

        return first;
    }
}
